package com.huitone.gddw.service.impl.monitoring;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.huitone.gddw.common.ComConstant;
import com.huitone.gddw.dao.monitoring.IUnifyMonitorDao;
import com.huitone.gddw.service.dto.monitoring.UnifyMonitorDTO;
import com.huitone.gddw.service.monitoring.IUnifyMonitorService;

/**
 * 统一监控图
 * @author wuluodan
 *
 */
@Service
public class UnifyMonitorService implements IUnifyMonitorService {

	@Autowired
	private IUnifyMonitorDao unifyMonitorDao;
	
	@Override
	public List<UnifyMonitorDTO> findSrv(Map<String, Object> params) {
		params.put("objType", ComConstant.FLOW);
		params.put("applications", ComConstant.FLOW);
		return unifyMonitorDao.findSrv(params);
	}

	@Override
	public List<UnifyMonitorDTO> findService(Map<String, Object> params) {
		return unifyMonitorDao.findService(params);
	}

	@Override
	public List<UnifyMonitorDTO> findCurFlow(Map<String, Object> params) {
		params.put("objType", ComConstant.FLOW);
		params.put("applications", ComConstant.FLOW);
		return unifyMonitorDao.findCurFlow(params);
	}

	@Override
	public Map<String, Object> findQueue(Map<String, Object> params) {
		Map<String, Object> map = new HashMap<>();
		map.put("cachelen", findCachelen(params));
		map.put("pri", findPri(params));
		return map;
	}
	
	/**
	 * 查询缓存队列
	 * @param params
	 * @return List<UnifyMonitorDTO>
	 */
	@Override
	public List<UnifyMonitorDTO> findCachelen(Map<String, Object> params) {
		return unifyMonitorDao.findCache(params);
	}
	
	/**
	 * 查询优先级队列
	 * @param params
	 * @return List<UnifyMonitorDTO>
	 */
	@Override
	public List<UnifyMonitorDTO> findPri(Map<String, Object> params) {
		return unifyMonitorDao.findPri(params);
	}

	@Override
	public List<UnifyMonitorDTO> findSmSend(Map<String, Object> params) {
		return unifyMonitorDao.findSmSendPercent(params);
	}

	@Override
	public List<UnifyMonitorDTO> findGateSmSend(Map<String, Object> params) {
		return unifyMonitorDao.findSendResultPercent(params);
	}

	@Override
	public List<UnifyMonitorDTO> findGateSpeed(Map<String, Object> params) {
		return unifyMonitorDao.findGateSpeed(params);
	}

}
